﻿using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using AutoMapper;
using Zapi.Api.Filters;
using Zapi.Start; 

namespace Zapi
{
    public class WebApiApplication : HttpApplication
    {
        protected void Application_EndRequest()
        {
           // WebApiApplicationConfig.EndRequest(this); 
        }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);

            GlobalConfiguration.Configuration.Filters.Add(new ErrorFilterAttribute());
            GlobalConfiguration.Configuration.Filters.Add(new LoginAttribute());
            GlobalConfiguration.Configuration.Filters.Add(new ModelValidFilterAttribute());
            GlobalConfiguration.Configuration.Filters.Add(new LogsFilterAttribute());
            //配置AutoMapper
            Mapper.Initialize(a => a.AddProfile(new SourceProfile()));
        }
    }
}
